package com.fudan.gamestore.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

public class Order {
    private Integer orderId;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")  //接收参数的格式
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")  //输出参数的格式
    private Date orderDate;
    private Integer userId;
    private Double orderMoney;
    private Integer orderState;
    private List<OrderItem> orderItemList;

    public Order() {
    }

    public Order(Integer orderId, Date orderDate, Integer userId, Double orderMoney, Integer orderState,
                 List<OrderItem> orderItemList) {
        this.orderId = orderId;
        this.orderDate = orderDate;
        this.userId = userId;
        this.orderMoney = orderMoney;
        this.orderState = orderState;
        this.orderItemList = orderItemList;
    }

    public Order(Integer userId, Integer orderState) {
        this.orderId = null;
        this.orderDate = new Date(System.currentTimeMillis());
        this.userId = userId;
        this.orderMoney = 0.0;
        this.orderState = orderState;
        this.orderItemList = null;
    }

    public Integer getOrderId() {
        return orderId;
    }

    public void setOrderId(Integer orderId) {
        this.orderId = orderId;
    }

    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Double getOrderMoney() {
        return orderMoney;
    }

    public void setOrderMoney(Double orderMoney) {
        this.orderMoney = orderMoney;
    }

    public Integer getOrderState() {
        return orderState;
    }

    public void setOrderState(Integer orderState) {
        this.orderState = orderState;
    }

    public List<OrderItem> getOrderItemList() {
        return orderItemList;
    }

    public void setOrderItemList(List<OrderItem> orderItemList) {
        this.orderItemList = orderItemList;
    }

    @Override
    public String toString() {
        return "Order{" +
                "orderId=" + orderId +
                ", orderDate=" + orderDate +
                ", userId=" + userId +
                ", orderMoney=" + orderMoney +
                ", orderState=" + orderState +
                ", orderItemList=" + orderItemList +
                '}';
    }
}
